package week;

public class FindClosest {
    public static void main(String[] args) {
        int x = 2;
        int y = 7;
        int z = 4;
        System.out.println(findClosest(x, y, z));
    }
    public static int findClosest(int x, int y, int z) {
        int closeX = x >= z ? x - z : z - x;
        int closeY = y >= z ? y - z : z - y;
        if (closeX == closeY) {
            return 0;
        }else {
            return closeX > closeY ? 2 : 1;
        }
    }
}
